//
//  LabelTextHeight.m
//  CaiBaProject
//
//  Created by . on 2017/6/26.
//  Copyright © 2017年 . All rights reserved.
//

#import "LabelTextHeight.h"

@implementation LabelTextHeight


+ (CGFloat)heightFromString:(NSString*)text withFont:(UIFont*)font constraintToWidth:(CGFloat)width
{
    if (text && font) {
        CGRect rect  = [text boundingRectWithSize:CGSizeMake(width, 1000) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil];
        
        return rect.size.height;
    }
    return 0;
}


@end
